<template>
  <div>
    <h1>资源状态</h1>
    <el-table :data="currentList" border style="width: 100%">
      <el-table-column prop="name" label="患者姓名"></el-table-column>
      <el-table-column prop="zhenduan" label="病种" sortable></el-table-column>
      <el-table-column prop="region" label="地址" sortable></el-table-column>
      <el-table-column prop="phone" label="患者电话" sortable></el-table-column>
      <el-table-column prop="msgsource" label="患者来源" sortable></el-table-column>
      <el-table-column prop="createTime" label="创建日期" sortable></el-table-column>
      <el-table-column prop="lastTime" label="修改日期" sortable></el-table-column>
      <el-table-column prop="status" label="状态" sortable></el-table-column>
      <el-table-column prop="zxdf" label="咨询大夫" sortable></el-table-column>
      <el-table-column prop="doctor" label="主治医师" sortable></el-table-column>
      <el-table-column prop="createName" label="创建人" sortable width="90"></el-table-column>
    </el-table>
    <page :allList="allList" @parentCurrentList="getcurrentList"></page>
  </div>
</template>
<script>
import axios from "axios";
import page from "../page";
export default {
  mounted () {
    this.getState();
  },
  components: {
    page
  },
  data () {
    return {
      allList: [],
      currentList: [],
      currentPage: 1,
      SizeChangeLength: 10
    };
  },
  methods: {
    // 获取数据
    getState () {
      axios.post('api/state').then(res => {
        if (res.data.status == 0) {
          // 反转数组
          this.allList = res.data.data.reverse();
          for (let i = 0; i < 10; i++) {
            this.currentList.push(this.allList[i]);
          }
        }
      }).catch(error => {
        console.log(error)
      })
    },
    // 当前页面的数据
    getcurrentList (data) {
      this.currentList = data;
    }
  }
};
</script>
<style lang="stylus" scoped>

.el-select {
  width: 80px !important;
}

.input-with-select .el-input-group__prepend {
  background-color: #fff;
}

.input-with-select {
  width: 500px;
  margin-bottom: 15px;
}
</style>
